Envelope Printer Version 2.0 By Michael J. Himowitz CIS 71655,1327 Federal Hill Software 8134 Scotts Level Road Baltimore, MD 21208 This is a little Visual Basic utility that will print an envelope on a Hewlett Packard LaserJet II/compatible or IBM ProPrinter without requiring that you change your printer setup in Windows. This version (the previous version was called HPENV.ZIP) adds ProPrinter support, since the ProPrinter has an envelope slot. It also allows you to select the printer port, in case you have two printers hooked up. To choose the printer/port combination, just click on Select Printer in the top menu bar. Your choice will always be displayed in a box at the bottom of the form. I've only been fooling around with VB for a couple of weeks now and don't claim to be any kind of expert (anyone who looks at the code will see that). But this one seems to work. Most of the time, people have their laser printer set for portrait mode. Unfortunately, if you want to use a word processor to print an envelope, you have to go into Printer Setup and change to landscape mode to print the envelope, then reset the whole shebang for portrait mode. It's a pain. This program bypasses Print Manager and sends strings directly to the printer. If you're using a LaserJet, it puts the printer into landscape mode, prints the envelope and then resets it to portrait mode. It doesn't seem to interfere with Windows programs that use Print Manager, since they apparently initialize the printer each time they use it. I had no problem printing a document with AmiPro, printing the envelope with HPENV, and then printing the document again from AmiPro. The main drawback is that the program will only use the HP's default Courier typeface. But that's fine for most business correspondence, and if you want an envelope quickly, this will do it. You can enter up to six lines of address information, and a four line return address. The sixth line of the address will print in the lower left hand corner of the envelope. You don't have to use all six lines. Just leave the ones you don't want to use blank. To print the envelope, click on the PRINT command button. To clear the current address information, click on the CLEAR command button. By clicking on Return Address on the top menu line or on the Return Address block, you'll bring up a return address form. Just fill in the blanks. You can also click on a button that tells the program whether to print the return address or not. So even if you've entered a return address, you don't have to use it. The printing is accomplished by opening a file called "\DEV\LPTX" (where "X" is 1 or 2) which goes directly to the printer without using print manager. I haven't found it documented in the manual, but it's a standard DOS device designator and seems to work fine. To give credit where it's due, I got the idea for the program and the HP printer codes that accomplish the job from a dBase program published in PC Computing Magazine. There's a mistake or two in the magazine's codes, so don't use those. The trick is to set the x and y position of the LaserJet's cursor for each line of the envelope. If you have cartridge fonts or soft fonts downloaded and want to access them, you can add the HP codes to use them, although you may have to adjust the x and y positions of the printer cursor to get the proper spacing. The ProPrinter routine is more straightforward. I'd already developed a program print an envelope on that one and just borrowed the code. It's a straight tabbing job. The same code, with minor line spacing and tabbing modifications, should work on any printer with an envelope slot (The Panasonic 1124 comes to mind). Feel free to play with the program and make improvements or changes. A couple of possible ideas are tying the print routines into a name and address file, or setting up a default file that stores a return address and reading it in at run time. You can also use the print routines for things like tractor feed mailing labels on dot matrix printers, which get all fouled up with VB's printer.print and EndDoc. Mike Himowitz